package client

import (
	. "starsine.cn/appTpl/cmn/defs"
	"starsine.cn/appTpl/cmn/logs"
	"starsine.cn/appTpl/svccenter/registry/grpc/scregistryproto"
)

var grpcClient *GRpcClient = nil

func Start(appCtxt *AppContext) {
	grpcClient = CreateGRpcClient(appCtxt)
	grpcClient.Start()

	logs.Infof("registry.client start")
}

func SvcRegist(in *scregistryproto.SvcInfo) (*scregistryproto.RegistryInfo, error) {
	return grpcClient.SvcRegist(in)
}

func SvcGet(in *scregistryproto.SvcGetReq) (*scregistryproto.SvcGetRes, error) {
	return grpcClient.SvcGet(in)
}

func SvcGetAll(in *scregistryproto.SvcGetAllReq) (*scregistryproto.SvcGetAllRes, error) {
	return grpcClient.SvcGetAll(in)
}

func SvcHeartbeat(in *scregistryproto.HeartbeatReq) (*scregistryproto.HeartbeatRes, error) {
	return grpcClient.SvcHeartbeat(in)
}

func SubSvcRegister(in *scregistryproto.SubSvcRegisterReq) (*scregistryproto.Res, error) {
	return grpcClient.SubSvcRegister(in)
}

func SubSvcUpdate(in *scregistryproto.SubSvcUpdateReq) (*scregistryproto.Res, error) {
	return grpcClient.SubSvcUpdate(in)
}

func UnSubSvcUpdate(in *scregistryproto.SubSvcUpdateReq) (*scregistryproto.Res, error) {
	return grpcClient.UnSubSvcUpdate(in)
}
